package com.own.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

/**
 * ConstantAccount
 *
 * @author chenxueli
 * @date 2024-03-14 14:58:43
 */
public class ConstantAccount {

    @Getter
    @AllArgsConstructor
    public enum TypeEnum {
        /**
         * 普通用户
         */
        NORMAL(Type.NORMAL),
        /**
         * 管理员
         */
        ADMIN(Type.ADMIN);

        private static final Map<Integer, TypeEnum> MAP = new HashMap<>() {{
            for (TypeEnum type : TypeEnum.values()) {
                put(type.value, type);
            }
        }};
        private final int value;

        public static TypeEnum of(int value) {
            return MAP.get(value);
        }

    }

    public interface Type {
        /**
         * 普通用户
         */
        int NORMAL = 1;
        /**
         * 管理员
         */
        int ADMIN = 2;
    }

}
